package org.zbclan.bf2.rcon.client;

import com.google.gwt.core.client.JavaScriptObject;

public class JsProperties {

	// private final JavaScriptObject prop;
	JavaScriptObject prop;

	// public JsProperties(JavaScriptObject properties) {
	JsProperties(JavaScriptObject properties) {
		this.prop = properties;
	}

	public String get(String name) {
		return getImpl(this.prop, name);
	}

	public int getInt(String name) {
		String val = get(name);
		return val == null ? 0 : Integer.valueOf(val);
	}

	private static native String getImpl(JavaScriptObject p, String name) /*-{
		return p[name] ? p[name].toString() : p[name] === false ? "false" : null;
	}-*/;
}